package me.gm.stcont.controller;

import me.gm.stcont.PropertiesWrapper;
import me.gm.stcont.repository.AuthorityRepository;
import me.gm.stcont.repository.IndividualRepository;
import me.gm.stcont.repository.StoreRepository;
import me.gm.stcont.repository.UserRepository;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

public abstract class BaseController {

	private Logger logger;

	@Autowired
	private PropertiesWrapper propertiesWrapper;

	@Autowired
	private StoreRepository storeRepository;

	@Autowired
	private UserRepository userRepository;

	@Autowired
	private AuthorityRepository authorityRepository;

	@Autowired
	private IndividualRepository individualRepository;

	public BaseController() {
		this.logger = Logger.getLogger(this.getClass());
	}

	public Logger getLogger() {
		return logger;
	}

	public PropertiesWrapper getPropertiesWrapper() {
		return propertiesWrapper;
	}

	public StoreRepository getStoreRepository() {
		return storeRepository;
	}

	public UserRepository getUserRepository() {
		return userRepository;
	}

	public AuthorityRepository getAuthorityRepository() {
		return authorityRepository;
	}

	public IndividualRepository getIndividualRepository() {
		return individualRepository;
	}

	public Pageable getPageable(int start, int offset, Sort sort) {
		PageRequest pageRequest;

		pageRequest = new PageRequest(start, offset, sort);

		return pageRequest;
	}

}
